package com.itheima.reggie.mapper;


import com.itheima.reggie.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DishFlavorMapper {


    /**
     * 批量添加口味
     * @param dishFlavors
     * @return
     */
    int addBatchDishFlavor(@Param("dishFlavors")List<DishFlavor> dishFlavors);

    /**
     * 根据dishId查询所有口味
     * @param id
     * @return
     */
    @Select("select * from dish_flavor where dish_id = ${id}")
    List<DishFlavor> findDishFlavorsByDishId(long id);

    @Delete({"delete from dish_flavor where dish_id = #{id}"})
    int deleteByDishId(Long id);
}
